<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户开发计划</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/client/style.css" type="text/css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/admin-all.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css"/>
    <script src="${pageContext.request.contextPath}/js/layui/layui.all.js"></script>
    <script src="${pageContext.request.contextPath}/js/jquery/jquery-3.3.1.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layui/layui.all.js"></script>

    <script type="text/javascript">
        function makePlan(id) {
           // 制定计划
            window.location.href="makePlan?id="+id;
        }

        function doPlan(id) {
            // 执行计划
            window.location.href="doPlan?id="+id;
        }

        function updPlan(id) {
            // 将状态修改为开发成功
            layer.alert("开发成功!");
            setTimeout(go,2000);
            function go(){
              window.location.href="updPlan?id="+id+"&notes= '开发成功'"+"&type=success";
            }
        }
    </script>
</head>

<body>
<div class="alert alert-info">客户开发计划</div>
<form action="queryOppo" method="post">
    <div class="button_bar">
        <input type="button" class="common_button" onclick="layer.alert('欢迎使用!')" value="帮助">
        <input type="button" class="common_button" onclick="form.submit()" value="查询">
    </div>
    <table class="query_table">
        <tr>
            <th>客户名称</th>
            <td><input type="text" name="customer_name"></td>
            <th>概要</th>
            <td><input type="text" name="summarize"></td>
            <th>联系人</th>
            <td><input type="text" name="linkman"></td>
        </tr>
    </table>
</form>
<br />
<table class="data_table">
	<tr>
	   <th width="5%">编号</th>
		<th width="10%">客户名称</th>
		<th width="19%">概要</th>
		<th width="17%">联系人</th>
		<th width="15%">联系人电话</th>
		<th width="16%">创建时间</th>
		<th width="7%">状态</th>
		<th width="11%">操作</th>
	</tr>


<c:forEach items="${pageInfo.list}" var="sale" varStatus="status">
	<tr>
		<td class="number">${status.index+1}</td>
		<td class="text">${sale.customer_name}</td>
		<td class="ltext">${sale.summarize}</td>
		<td class="text">${sale.linkman}</td>
		<td class="text">${sale.link_tel}</td>
		<td class="text">${sale.create_time}</td>
		<td class="text ">${sale.status}</td>
		<td class="op">
			<img class="op_button" src="${pageContext.request.contextPath}/images/create.gif" onclick="makePlan(${sale.id});" title="制订计划" />
			<img class="op_button" src="${pageContext.request.contextPath}/images/do.gif" onclick="doPlan(${sale.id})" title="执行计划"   />
			<img class="op_button" src="${pageContext.request.contextPath}/images/yes.gif"  onclick="updPlan(${sale.id});" title="开发成功" />
		</td>
	</tr>
</c:forEach>
</table>
<div class="page_down">
    <div class="page_down_dv1"> 共有<strong>${pageInfo.total} </strong> 条记录，当前第<strong> ${pageInfo.pageNum} </strong> 页，共 <strong>${pageInfo.pages}</strong> 页 </div>

    <div class="page_down_dv2">
        <ul>
            <li>                   <!--首页-->
                <a href="javascript:void(0)" onclick="first()">
                    <img src="${pageContext.request.contextPath}/images/main_54.gif" width="40" height="15" />
                </a>
            </li>


            <li>                  <!--上一页-->
                <a href="javascript:void(0)" onclick="pre()" >
                    <img src="${pageContext.request.contextPath}/images/main_56.gif" width="40" height="15" />
                </a>
            </li>

            <li>                <!--下一页-->
                <a href="javascript:void(0)" onclick="next()" >
                    <img src="${pageContext.request.contextPath}/images/main_58.gif" width="40" height="15" />
                </a>
            </li>

            <li>                <!--尾页-->
                <a href="javascript:void(0)" onclick="last()" >
                    <img src="${pageContext.request.contextPath}/images/main_60.gif" width="40" height="15" />
                </a>
            </li>

            <li><span>转到</span></li>
            <li>
                <input type="text" style=" width:25px;" id="pageNum" onblur="forwardTo()" />
            </li>
            <li><span>页</span></li>
            <li>
                <a href="javascript:void(0)" onclick="forwardTo()">
                    <img src="${pageContext.request.contextPath}/images/main_62.gif" width="26" height="15" />
                </a>
            </li>
        </ul>
    </div>
</div>


<!--pagehelper 分页 前台参数-->
<script type="text/javascript">

    //首页
    function first() {
        var pageNum = ${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1;
        window.location.href = "queryOppo?pageNum="+pageNum;
    }

    //上一页
    function pre() {
        var pageNum = ${pageInfo.hasPreviousPage}?${pageInfo.prePage}:1;
        window.location.href = "queryOppo?pageNum="+pageNum;
    }

    //下一页
    function next() {
        var pageNum=${pageInfo.hasNextPage}?${pageInfo.nextPage}:${pageInfo.pages};
        window.location.href = "queryOppo?pageNum="+pageNum;
    }

    //尾页
    function last() {
        var pageNum=${pageInfo.pages};
        window.location.href = "queryOppo?pageNum="+pageNum;
    }

    //跳转
    function forwardTo() {
        var pageNum=$("#pageNum").val();
        if(pageNum.trim()=="" || (pageNum.trim()> ${pageInfo.pages} ) || (pageNum.trim() < 1) ){
            layer.alert("请输入正确的页码!")
        }else{
            window.location.href = "queryOppo?pageNum="+pageNum;
        }

    }
</script>
</body>
</html>
